Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated: output xml with comment node. #9

Merged
merged 2 commits into from
Dec 23, 2018
Merged

updated: output xml with comment node. #9

merged 2 commits into from
Dec 23, 2018

Conversation

yitype
Copy link
Contributor

@yitype yitype commented Dec 22, 2018

The comment node should output as a block of comment text

@coveralls
Copy link

Coverage Status

Coverage increased (+0.4%) to 82.663% when pulling d622cb9 on zhao5908:output-xml into 431a9e9 on antchfx:master.

@coveralls
Copy link

coveralls commented Dec 22, 2018

Coverage Status

Coverage decreased (-0.06%) to 82.25% when pulling e31a81f on zhao5908:output-xml into 431a9e9 on antchfx:master.

@zhengchun
Copy link
Contributor

Thanks for your commit, test is passed. But i have a question, when or under what case should we output comment node? At most of the time, comment node doesn't make sense in the XML document, we don't care about it.

@zhengchun
Copy link
Contributor

zhengchun commented Dec 23, 2018

belowing document output is incorrect.

<?xml version="1.0" encoding="UTF-8"?>
	<!-- comment here-->
    <AAA> 
        <BBB> 
            <DDD> 
                <CCC> 
					<DDD/> 
					<!-- DDD -->
					<!-- DDD -->
					<!-- DDD -->
					<EEE/> 
				</CCC> 
				<!-- CCC -->
				<!-- CCC -->
            </DDD> 
		</BBB> 
		<!-- CCC -->
		<!-- CCC -->
        <CCC> 
			<DDD> 
			<!-- EEE -->
			<!-- EEE -->
			<!-- EEE -->
			<!-- EEE -->
                <EEE> 
					<DDD> 
					<!-- FFF -->
                        <FFF/> 
					</DDD> 
					<!-- FFF -->
					<!-- FFF -->
					<!-- FFF -->
                </EEE> 
            </DDD> 
        </CCC> 		
     </AAA>

should add following code to confirm its level.

for i := prev.level - level; i > 1; i-- {
	prev = prev.Parent
}
addSibling(prev.Parent, node)

@yitype
Copy link
Contributor Author

yitype commented Dec 23, 2018

Thanks for your advice, In my api proxy case, I parse xml-rpc, record some raw xml node value, then convert to other type. The OutputXML() should distinguish between text and comment. comment should been ignored, not as text.

@zhengchun zhengchun merged commit e31a81f into antchfx:master Dec 23, 2018
zhengchun added a commit that referenced this pull request Dec 23, 2018
zhengchun added a commit that referenced this pull request Dec 23, 2018
zhengchun added a commit that referenced this pull request Dec 23, 2018
@zhengchun
Copy link
Contributor

Thanks, merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants