我正在使用XSLT样式表处理XML文件,并希望在触发给定模板时报告输入行号.我可以使用支持SAX解析器的DOM(例如Java中的XOM),因此也许可以使用Locator.
或者,XSLT生成可以应用于原始文档的Xpath,因此,至少对于人来说,可以导致特定的行.
(实际应用程序是检测XML中的错误条件,使用XSLT搜索)
我正在尝试从sourceforge(jtmt.sf.net)安装Maven发行版,它提供了一个POM.Hoewever
mvn install
Run Code Online (Sandbox Code Playgroud)
抛出错误:
[ERROR] 'build.plugins.plugin[org.mortbay.jetty:maven-jetty6-plugin].depende
ncies.dependency.scope' for org.apache.geronimo.specs:geronimo-j2ee_1.4_spec:jar
must be one of [compile, runtime, system] but is 'provided'. @ line 653, column
20
Run Code Online (Sandbox Code Playgroud)
pom包含代码:
<!-- For web development with Jetty6 -->
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty6-plugin</artifactId>
<configuration>
<scanIntervalSeconds>10</scanIntervalSeconds>
<connectors>
<connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
<port>8081</port>
<maxIdleTime>60000</maxIdleTime>
</connector>
</connectors>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-j2ee_1.4_spec</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
</plugin>
Run Code Online (Sandbox Code Playgroud)
我假设POM过去工作过,虽然现在项目有点休眠.
安装时是否应该设置一些开关?(我使用的是mvn 3.0.3).发布商已经检查了大量的库lib/.
我有许多类的集合,我需要重构为新类.我在Eclipse或Netbeans中使用Java.目前,我使用委托List <Foo>创建新类FooList,然后按照代码无法编译的所有位置进行操作.有没有办法在不破坏代码的情况下执行此操作(最好是单个操作)?
编辑我有以下类型的构造:
public static List<Foo> Bar.createFooList(String s)
Run Code Online (Sandbox Code Playgroud)
并List<Foo>在其他地方经常使用,它作为业务对象是有意义的FooList.我手动完成了这个:
public class FooList {
private List<Foo> fooList;
public FooList(String s) {
createList(s);
}
private void createList(String s) {//...}
public int size() {return fooList.size();}
}
Run Code Online (Sandbox Code Playgroud)
FooList还将包含List之外的方法.例如现在:
Bar.normalize(List<Foo> fooList);
Run Code Online (Sandbox Code Playgroud)
然后会成为
fooList.normalize();
Run Code Online (Sandbox Code Playgroud)
其他函数需要List I的方法时,我使用Eclipse中的Source | Generate Delegate Methods选项在FooList中生成这些方法(与上面的size()一样).
我可以看到实现List <Foo>的吸引力@JonSkeet,但我看不出如何自动更改我的所有代码.
我希望正则表达式可以解析具有可选前导空格的固定长度字段中的右对齐数值.(这基本上是FORTRAN输出,但还有许多其他工具可以做到这一点).我知道场地的宽度.
假设该字段是宽度为5(I5)的整数.然后以下是所有符合的数值:
" 123"
"12345"
"-1234"
" -1"
Run Code Online (Sandbox Code Playgroud)
我不能对前面和后面的字段做出任何假设.因此以下内容适用于I3,I5,I2:
"-121234512"
Run Code Online (Sandbox Code Playgroud)
并产生价值-12, 12345和12.
应该没有与正则表达式相关的其他代码.我正在使用Java正则表达式,但我希望这是相当普遍的(至少符合C#).
如果可以对整数进行此操作,我还希望正则数据包含包含小数点的实数,例如 F10.3
" -12.123"
Run Code Online (Sandbox Code Playgroud) 我有直接在浏览器(目前是IE和Firefox)中显示的SVG文档 - 通过将*.svg直接加载到浏览器中.这些文档包含我想要显示为"HTML"的文本,例如在带有自动换行,下标和可能滚动的HTML窗口/面板中呈现.SVG和HTML在正确的命名空间下构建和管理.
典型的元素(没有样式)可能是:
<svg xmlns="http://www.w3.org/2000/svg">
<g>
<rect x="100" y="200" width="300" height="400"/>
<h:p xmlns:h="http://www.w3.org/1999/xhtml">
This is an <h:i>italic</h:i> and a <h:sub>subscript</h:sub> in a ...
very long ... paragraph which will need word wrapping and maybe scrolling
</h:p>
</g>
</svg>
Run Code Online (Sandbox Code Playgroud)
能够在给定的边界框内找到文本(例如<rect />)会很高兴
请注意,目前我不想在HTML文档中嵌入SVG,也不需要递归(例如HTML中没有SVG).
更新:@Sirko鼓励我在网上发现这篇文章已经4年了.
我尝试构建简单的应用程序,我想使用spring,wicket和JPA2.0(Hibernate).把所有这些放在一起我使用maven.我有hibernate的问题.下面是我的pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>comicsTest</groupId>
<artifactId>comicsTest</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<repositories>
<repository>
<id>jboss-public-repository-group</id>
<name>JBoss Public Repository Group</name>
<url>https://repository.jboss.org/nexus/content/repositories/releases/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>3.0.5.RELEASE</version>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>wicket</groupId>
<artifactId>wicket</artifactId>
<version>1.2.7</version>
</dependency>
<dependency>
<groupId>wicket</groupId>
<artifactId>wicket-spring</artifactId>
<version>1.2.7</version>
</dependency>
<dependency>
<groupId>wicket</groupId>
<artifactId>wicket-extensions</artifactId>
<version>1.2.7</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.hiberante</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>3.6.0.Final</version>
</dependency>
</dependencies>
<modules>
</modules>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
Run Code Online (Sandbox Code Playgroud)
而我得到的只是
27.12.10 12:41:44 CET: Refreshing [/comicsTest/pom.xml]
27.12.10 12:41:48 CET: Downloaded …Run Code Online (Sandbox Code Playgroud) 布尔值中操作数的顺序是否会影响评估顺序?我可以依靠一个例子
String s = ...;
if (s != null && s.length() > 10) ...
Run Code Online (Sandbox Code Playgroud)
我似乎记得Java语言没有定义评估顺序,并且null值s可能导致NPE.这仍然是正确的(a)原则上和(b)在实践中使用常见的Java实现吗?
更新:我找不到确切的副本.有趣的是看到答案中的意见分歧并得到它的支持 - 嗯好!
java ×2
maven ×2
boolean ×1
collections ×1
hibernate ×1
html ×1
jpa-2.0 ×1
list ×1
refactoring ×1
regex ×1
stanford-nlp ×1
svg ×1
xpath ×1
xslt ×1