473,398 Members | 2,088 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

inserting and deleting valid xml nodes

Hello,
I program an xml editor with xerces for the university of
Braunschweig, the user
dont see any xml tags, it is represented in a JTree.
Now the user shall be able to insert nodes, which
conforms to the schema file (the user need not know what
that is, its transparent to him). I found two approaches for doing
that:

1. When xerces validates the source or the DOM tree (this is a new
xerces feature
and is faster since the tree structure is already there, by
normalizeDocument()),
it builds up for each node a vector holding all possible allowed
schema types, and
then just looks if that node's type is in that vector. I could
store that vector for my own purposes and let the user choose, what
node he wants to insert, according to the vector.
There are some difficulties in that: First, its hard to get that
vector,
there are not-public methods building it up and using it, its very
hard.
Second, DOMNormalizer only accepts the document root as input, and not
a child
node, but I dont want to run the DOMNormalizer after each little
modification on the
whole file, this would take to much time at a large file and a quick
user. Surely with some "hacking" (that means, with modification of
xerces source files) I could do it on child nodes somehow, but this is
even more complicated. Moreover, if I insert a node, I would have to
check
if the following sibling nodes are allowed at there new by-one-shifted
positions. This is needed especially at the deletion of a node in
backwards direction. Otherwise the node's type is not allowed to be
inserted or deleted.

2. I could use PSVI information. With PSVI information, I can see the
schema type definition of every node in the DOM tree. The good thing
is that I dont need to modify
internal xerces files. But what I dont know right now, since I not
programmed
it yet: If I can get an exact vector of all allowed schema node types
possible for one position in the DOM tree like with the first
approach. Moreover i am
cared about the thought that with this approach, I would virtually
program
a complete validator: the schema type of an element is defined by the
elements
name, which can be simply looked up in the schema file. So the
pseudocode

while GetNextElementName do
if !(ElementType isin VectorWithAllowedTypesAtCurrentPosition) then
DocumentIsNotValid();
looks to me like a validator!
So nice of you to read such much text, any suggestions what i should
do are welcome!
PS: it could be that i messed up some things, I am just tackling the
problems
again after months of delay.
Jul 20 '05 #1
0 1472

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Rick | last post by:
Hi, Does deleting an object more than one times incur undefined behavior? I think it doesn't but just making sure... thanks Rick
3
by: Joachim Klassen | last post by:
Hi all, first apologies if this question looks the same as another one I recently posted - its a different thing but for the same szenario:-). We are having performance problems when...
1
by: jez123456 | last post by:
Hi, I have a windows form with a listbox control. My code all works correctly when deleting an item from the listbox except the last item. I get the following message when trying to delete the...
2
by: melanieab | last post by:
Hi, I'm deleting nodes in my xml file, and it does seem to work, but then when I later reload the file and make an xmlNodeList, the nodelist count still includes the deleted nodes yet the file...
2
by: Clark Stevens | last post by:
Hi. This should be so easy, but I don't get it. Let say I have RichTextbox1 and I want to insert some text at the current insertion point, or at the beginning of selected text (if there is any). ...
1
by: yuchang | last post by:
Hi, Using the FormView control is very efficient. But I want to do some action,like showing a success message or redirect to another page, after inserting, updating and deleting. How do I get...
6
by: DWrek | last post by:
Here is my problem. I have an XML document that is returned to me by a third party service. The XML document contains results for a search but only lists a maximum of 10 results. If there are any...
12
by: desktop | last post by:
Why does insert only work when specifying an iterator plus the object to be inserted: std::vector<intt; std::vector<int>::iterator it; it = t.begin(); t.insert(it,33); If I use push_back...
2
by: vinrin | last post by:
Thank for your answer. :-) call CheckEmptyNode (treeview) public void CheckEmptyNode( Object N ) { Microsoft.Web.UI.WebControls.TreeNode menuNode = null; ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.