0

I have developed a small java program for automatic XML code generation for our project. here we have some JSON files where we have the code template.For every new component the corresponding JSON file is read and the code block is updated with the new component values and the xml files are auto updated with these code blocks.
Now the code should be added to the specific points in the file, so as a pointer I have code comments like:

<tag>
...
<!--Add the configuration code here -->
...
...
<!--Add the deletion code here -->
</tag>

Now I need to create a metadata of these comments. so that I can read these comments , check if they exist in the file and then add the code.

Anyone who can tell me the best way to do this.

1 Answer 1

1

It's hard to answer without more detailed description, but I assume that what you need is to find particular comment, and append new node to it containing generated code.

You can parse the DOM tree to find nodes of type Node.COMMENT_NODE and the do your thing when you find it. Here are some code samples that can point you in the right direction:

http://www.programcreek.com/java-api-examples/org.w3c.dom.Comment

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.