针对多个XSD验证XML文件并知道哪个验证文件(jdom2)(Validate XML file against several XSD and know which one validates the file (jdom2))
我想对两个不同的XSD验证XML文件,知道XML文件不必针对它们而是仅针对其中的一个进行验证。 然后我需要知道哪个XSD文件验证XML文件以访问不同的元素。
XSD文件属于以下类型: sdf和csdf但我有自己的版本,因此我不使用XML标头中存在的模式(我不想要求用户修改它)。
问题:如何轻松地进行验证测试,然后使用单个XML库(如果可能的话,使用jdom2)解析XML文件(根据正确的模式)?
目前我使用javax进行验证,使用jdom2访问元素,但我认为/希望可以使用单个库做同样的事情,至少为了不再一次解析文件。 正如在一个类似的问题中指出的那样,为了了解javax是如何工作的,我宁愿不吸毒。
I would like to validate XML files against two different XSD, knowing that the XML file does not have to be validated against both of them but only one of them. Then I need to know which XSD file validates the XML file in order to access different elements.
The XSD files are of this types: sdf and csdf but I have my own versions so I do not use the schema present in the XML header (and I don't want to require the user to modify this).
Question: how to easily do the validation test and then parse the XML file (according to the right schema) using a single xml library (and if possible jdom2) ?
Currently I use javax for the validation and jdom2 to access elements but I think/hope it is possible to do the same thing using one single library, at least in order to do not parse again and again the files. And well, as pointed out in a smilar question, I'd prefer to do not take drugs in order to understand how javax works.
原文:https://stackoverflow.com/questions/35199527
最满意答案
SELECT prod_id, prod_name, SUM(quantity) FROM purchasesdetails LEFT JOIN products ON (products._id=purchasesdetails.prod_id) GROUP BY prod_id where prod_in not in SELECT prod_id FROM notedetails LEFT JOIN products ON(notedetails.prod_id=products._id) GROUP BY prod_id
你可以不用in子句。
SELECT prod_id, prod_name, SUM(quantity) FROM purchasesdetails LEFT JOIN products ON (products._id=purchasesdetails.prod_id) GROUP BY prod_id where prod_in not in SELECT prod_id FROM notedetails LEFT JOIN products ON(notedetails.prod_id=products._id) GROUP BY prod_id
U can use not in clause.
相关问答
更多-
有什么数据库专业书籍介绍?[2022-05-19]
mysql -
您需要为该查询提供以下索引: transactions: INDEX(trn_date) accounts: INDEX(account_id) customers: INDEX(customer_id) 在最后两种情况下,您可能已将该列作为PRIMARY KEY 。 如果是这样,请不要添加冗余INDEX 。 You need these indexes for that query: transactions: INDEX(trn_date) accounts: INDEX(acc ...
-
你想要一个自我加入: SELECT A.`House Number` AS House FROM Houses AS A INNER JOIN Houses AS B ON A.`House Number`=B.`House Number` WHERE A.Attribute='Colour' AND A.Value='White' AND B.Attribute='Stories' AND B.Value='2' You want a self-join: SELECT A.`H ...
-
正如评论中所提到的,这只是插入mysql数据的一种缓慢方式,它更容易使用 connection.query('INSERT INTO Table (col1, col2) VALUES ?', [insert], callback); 其中insert是包含多个条目值的变量 As mentioned in the comments, this is just a slow way of inserting mysql data, it is much easier to use connection.que ...
-
不,它会工作得很好。 但是,您可能希望格式化查询,以便清楚哪些AND是独立的,哪些属于BETWEEN .. AND ...语句: SELECT * FROM users WHERE gender ='male' AND activated='yes' AND date_registered BETWEEN '$date1' AND '$date2' Nope, it will work just fine. However, you might want to format your ...
-
你必须过滤或者 (因为两种情况都不能匹配1条记录),然后找到两者都与having子句匹配的属性 SELECT product_id FROM product_properties WHERE property='example' AND value='230' OR property='power' AND value='110' group by product_id having count(distinct property) = 2 You have to filter on either ...
-
你可以这样做: select t.*, (previousDay - day) as diff from (select t.*, (@pd := (case when @n <> name then if(@n := name, NULL, NULL) -- does happen when (@tmp_pd := @pd) = null then null - ...
-
你可以使用mysql IN。 像这样: "SELECT mno FROM table1 WHERE (m_jid='$sid' AND decision IN ('accept-gf', '...', '...'))" 如果你想获得每个计数,你需要做这样的事情: "SELECT decision, COUNT(*) AS count FROM table1 WHERE (m_jid='$sid' AND decision IN ('accept-gf', '...', '...')) GROUP BY d ...
-
SELECT prod_id, prod_name, SUM(quantity) FROM purchasesdetails LEFT JOIN products ON (products._id=purchasesdetails.prod_id) GROUP BY prod_id where prod_in not in SELECT prod_id FROM notedetails LEFT JOIN products ON(notedetails.prod_id=products._id) ...
-
我想你可能正在寻找无缓冲的查询: 无缓冲的MySQL查询执行查询,然后在数据仍在MySQL服务器上等待获取时返回资源。 这在PHP端使用较少的内存,但可能会增加服务器的负载。 除非从服务器获取完整结果集,否则无法通过同一连接发送进一步的查询。 无缓冲的查询也可以称为“使用结果”。 这是一个无缓冲的查询示例: $get = $g_mysqli->query($query, MYSQLI_USE_RESULT); 你可以在这里阅读更多 I think you may be looking for unbuffe ...